$(document).ready(function() {

	function staticNav() { 
		var sidenavHeight = $("#sidenav").height();
		var winHeight = $(window).height();
		var browserIE6 = (navigator.userAgent.indexOf("MSIE 6")>=0) ? true : false;

		if (browserIE6) {
			$("#sidenav").css({'position' : 'absolute'});
		} else {
			$("#sidenav").css({'position' : 'fixed'});
		}
	
		if (sidenavHeight > winHeight) {
			$("#sidenav").css({'position' : 'static'});
		}
	}
	
	staticNav();
	
	$(window).resize(function () { //Each time the viewport is adjusted/resized, execute the function
		staticNav();
	});

});


$(document).ready(function() {

	function header() { 
		
		var sidenavHeight = $("#header").height();
		var winHeight = $(window).height();
		var browserIE6 = (navigator.userAgent.indexOf("MSIE 6")>=0) ? true : false;

		if (browserIE6) {
			$("#header").css({'position' : 'absolute'});
		} else {
			$("#header").css({'position' : 'fixed'});
		}
	
		if (sidenavHeight > winHeight) {
			$("#header").css({'position' : 'static'});
		}
	}
	
	header();
	
	$(window).resize(function () { //Each time the viewport is adjusted/resized, execute the function
		header();
	});

});
